home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2005 October / PCWOCT05.iso / Software / FromTheMag / XAMPP 1.4.14 / xampp-win32-1.4.14-installer.exe / xampp / apache / bin / apu-config.bat < prev    next >
DOS Batch File  |  2005-05-30  |  6KB  |  205 lines

  1. @rem = '--*-Perl-*--
  2. @echo off
  3. if "%OS%" == "Windows_NT" goto WinNT
  4. perl -x -S "%0" %1 %2 %3 %4 %5 %6 %7 %8 %9
  5. goto endofperl
  6. :WinNT
  7. perl -x -S %0 %*
  8. if NOT "%COMSPEC%" == "%SystemRoot%\system32\cmd.exe" goto endofperl
  9. if %errorlevel% == 9009 echo You do not have Perl in your PATH.
  10. if errorlevel 1 goto script_failed_so_exit_with_non_zero_val 2>nul
  11. goto endofperl
  12. @rem ';
  13. #!c:\xampp\perl\bin\perl.exe
  14. #line 15
  15. use strict;
  16. use warnings;
  17. use Getopt::Long;
  18. use File::Spec::Functions qw(catfile catdir);
  19.  
  20. # ====================================================================
  21. #
  22. #  Copyright 2003-2004  The Apache Software Foundation
  23. #
  24. #  Licensed under the Apache License, Version 2.0 (the "License");
  25. #  you may not use this file except in compliance with the License.
  26. #  You may obtain a copy of the License at
  27. #
  28. #      http://www.apache.org/licenses/LICENSE-2.0
  29. #
  30. #  Unless required by applicable law or agreed to in writing, software
  31. #  distributed under the License is distributed on an "AS IS" BASIS,
  32. #  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  33. #  See the License for the specific language governing permissions and
  34. #  limitations under the License.
  35. # ====================================================================
  36. #
  37. # APR-util script designed to allow easy command line access to APR-util
  38. # configuration parameters.
  39.  
  40.  
  41. sub usage {
  42.     print << 'EOU';
  43. Usage: apu-config [OPTION]
  44.  
  45. Known values for OPTION are:
  46.   --prefix[=DIR]    change prefix to DIR
  47.   --bindir          print location where binaries are installed
  48.   --includedir      print location where headers are installed
  49.   --libdir          print location where libraries are installed
  50.   --cc              print C compiler name
  51.   --cpp             print C preprocessor name and any required options
  52.   --ld              print C linker name
  53.   --cflags          print C compiler flags
  54.   --cppflags        print cpp flags
  55.   --includes        print include information
  56.   --ldflags         print linker flags
  57.   --libs            print additional libraries to link against
  58.   --srcdir          print APR-util source directory
  59.   --installbuilddir print APR-util build helper directory
  60.   --link-ld         print link switch(es) for linking to APR-util
  61.   --apu-so-ext      print the extensions of shared objects on this platform
  62.   --apu-lib-file    print the name of the aprutil lib
  63.   --version         print the APR-util version as a dotted triple
  64.   --help            print this help
  65.  
  66. When linking, an application should do something like:
  67.   APU_LIBS="\`apu-config --link-ld --libs\`"
  68.  
  69. An application should use the results of --cflags, --cppflags, --includes,
  70. and --ldflags in their build process.
  71.  
  72. EOU
  73.     exit(1);
  74. }
  75.  
  76. my ${CC} = q[cl];
  77. my ${LIBS} = q[];
  78. my ${installbuilddir} = q[O:\apache\build];
  79. my ${APRUTIL_LIB_TARGET} = q[];
  80. my ${bindir} = q[O:\apache\bin];
  81. my ${APRUTIL_SO_EXT} = q[dll];
  82. my ${LD} = q[link];
  83. my ${CPP} = q[cl -nologo -E];
  84. my ${LDFLAGS} = q[ kernel32.lib /nologo /subsystem:windows /dll /machine:I386 ];
  85. my ${includedir} = q[O:\apache\include];
  86. my ${exec_prefix} = q[O:\apache];
  87. my ${datadir} = q[O:\apache];
  88. my ${APRUTIL_LIBNAME} = q[libaprutil.lib];
  89. my ${libdir} = q[O:\apache\lib];
  90. my ${APRUTIL_DOTTED_VERSION} = q[0.9.6];
  91. my ${CFLAGS} = q[ /nologo /MD /W3 /O2 /D WIN32 /D _WINDOWS /D NDEBUG ];
  92. my ${SHELL} = q[D:\WINNT\system32\cmd.exe];
  93. my ${CPPFLAGS} = q[];
  94. my ${EXTRA_INCLUDES} = q[];
  95. my ${APRUTIL_SOURCE_DIR} = q[];
  96. my ${prefix} = q[O:\apache];
  97. my ${APRUTIL_MAJOR_VERSION} = q[0];
  98.  
  99. my %opts = ();
  100. GetOptions(\%opts,
  101.            'prefix:s',
  102.            'bindir',
  103.            'includedir',
  104.            'libdir',
  105.            'cc',
  106.            'cpp',
  107.            'ld',
  108.            'cflags',
  109.            'cppflags',
  110.            'includes',
  111.            'ldflags',
  112.            'libs',
  113.            'srcdir',
  114.            'installbuilddir',
  115.            'link-ld',
  116.            'apu-so-ext',
  117.            'apu-lib-file',
  118.            'version',
  119.            'help'
  120.           ) or usage();
  121.  
  122. usage() if ($opts{help} or not %opts);
  123.  
  124. if (exists $opts{prefix} and $opts{prefix} eq "") {
  125.     print qq{$prefix\n};
  126.     exit(0);
  127. }
  128. my $user_prefix = defined $opts{prefix} ? $opts{prefix} : '';
  129. my %user_dir;
  130. if ($user_prefix) {
  131.     foreach (qw(lib bin include build)) {
  132.         $user_dir{$_} = catdir $user_prefix, $_;
  133.     }
  134. }
  135.  
  136. my $flags = '';
  137.  
  138. SWITCH : {
  139.     local $\ = "\n";
  140.     $opts{bindir} and do {
  141.         print $user_prefix ? $user_dir{bin} : $bindir;
  142.         last SWITCH;
  143.     };
  144.     $opts{includedir} and do {
  145.         print $user_prefix ? $user_dir{include} : $includedir;
  146.         last SWITCH;
  147.     };
  148.     $opts{libdir} and do {
  149.         print $user_prefix ? $user_dir{lib} : $libdir;
  150.         last SWITCH;
  151.     };
  152.     $opts{installbuilddir} and do {
  153.         print $user_prefix ? $user_dir{build} : $installbuilddir;
  154.         last SWITCH;
  155.     };
  156.     $opts{srcdir} and do {
  157.         print $APRUTIL_SOURCE_DIR;
  158.         last SWITCH;
  159.     };
  160.     $opts{cc} and do {
  161.         print $CC;
  162.         last SWITCH;
  163.     };
  164.     $opts{cpp} and do {
  165.         print $CPP;
  166.         last SWITCH;
  167.     };
  168.     $opts{ld} and do {
  169.         print $LD;
  170.         last SWITCH;
  171.     };
  172.     $opts{cflags} and $flags .= " $CFLAGS ";
  173.     $opts{cppflags} and $flags .= " $CPPFLAGS ";
  174.     $opts{includes} and do {
  175.         my $inc = $user_prefix ? $user_dir{include} : $includedir;
  176.         $flags .= qq{ /I"$inc" $EXTRA_INCLUDES };
  177.     };
  178.     $opts{ldflags} and $flags .= " $LDFLAGS ";
  179.     $opts{libs} and $flags .= " $LIBS ";
  180.     $opts{'link-ld'} and do {
  181.         my $libpath = $user_prefix ? $user_dir{lib} : $libdir;
  182.         $flags .= qq{ /libpath:"$libpath" $APRUTIL_LIBNAME };
  183.     };
  184.     $opts{'apu-so-ext'} and do {
  185.         print $APRUTIL_SO_EXT;
  186.         last SWITCH;
  187.     };
  188.     $opts{'apu-lib-file'} and do {
  189.         my $full_apulib = $user_prefix ? 
  190.             (catfile $user_dir{lib}, $APRUTIL_LIBNAME) :
  191.                 (catfile $libdir, $APRUTIL_LIBNAME);
  192.         print $full_apulib;
  193.         last SWITCH;
  194.     };
  195.     $opts{version} and do {
  196.         print $APRUTIL_DOTTED_VERSION;
  197.         last SWITCH;
  198.     };
  199.     print $flags if $flags;
  200. }
  201. exit(0);
  202.  
  203. __END__
  204. :endofperl
  205.